<?php 
	if($_SERVER['REQUEST_METHOD'] == "POST"){
		if(isset($_POST['id']) && !empty($_POST['id'])){
			//delete from patient table
			unset($obj);
			$table_def 	= array('filter' => 'id = '.$_POST['id']);
			$obj = new Patient($table_def);
			$obj->Delete();

			//delete from patient_group
			unset($obj);
			$table_def 	= array('filter' => 'patient_id = '.$_POST['id']);
			$obj = new PatientGroup($table_def);
			$obj->Delete();

			//delete from user_patient
			unset($obj);
			$table_def 	= array('filter' => 'patient_id = '.$_POST['id']);
			$obj = new UserPatient($table_def);
			$obj->Delete();
		}
	}
?>